#!/bin/bash
# <bitbar.title>Show templateImages and images</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Stefan Rakel</bitbar.author>
# <bitbar.author.github>ibutra</bitbar.author.github>
# <bitbar.desc>Example of how to use the templateImage and image parameter</bitbar.desc>
# <bitbar.image>http://i.imgur.com/Rva36NL.png</bitbar.image>
# <bitbar.abouturl>https://github.com/matryer/bitbar-plugins/blob/master/Tutorial/images.sh</bitbar.abouturl>
#
# Images defined in the templateImage parameter are used as NSImage with template set to true, allowing Mac OS X to apply appropriate styling for the Menubar to them. This is the recommended way of defining an image for BitBar.
# Images defined in the image parameter are used as normal Images and can contain colors because no automatic styling is applied by Mac OS X. Note though this can lead to artifacts and other discolorization if the image is used in the statusbar of Mac OS X. Colored Images are not a problem if used in the dropdown menu.
# Both parameters accept imagefileformat natively supported by Mac OS X encoded as Base64 string.
# The recommended size for images in the statusbar and dropdown is 16x16 pixels.

# Showing only a gear in the statusbar. Text is not required but can by set
echo "| templateImage=iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAA6hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmF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jh2OWFDYvc7FieuL5EVfn2DP4n5Wa/sN9HM69WoWENSgLqnNcdojfdn8PrEHWiTJ+d20baBtKFk4lR8pWAN9UknA7Ov4R8hZntCEmAk1wAAAABJRU5ErkJggg=="
echo "---"

# While 16x16 pixel is recommended bigger images can be used in the dropdown
echo "Some option | image=iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAA6hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxNi0wMi0yOVQxOTowMjo5NTwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAzLjQuMTwveG1wOkNyZWF0b3JUb29sPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpDb21wcmVzc2lvbj41PC90aWZmOkNvbXByZXNzaW9uPgogICAgICAgICA8dGlmZjpSZXNvbHV0aW9uVW5pdD4yPC90aWZmOlJlc29sdXRpb25Vbml0Pgog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9GuvbCL7f3wt5NuiBEGtsfcZJjiEL98PV3i7ADwH4OqTljeyga9AD4Z4rEfgeanqD0FR1Ji6noZuAzV3oosAD90Y9EBjVLPqkqZwhDm4ETr0TTSuNlq2xjRRjfQVNU1Wo5OTYRQ9ApPOYsWLFclo4VgLgo5FHjDCIU4KIkM2puwS6Gehm4L/JwM/mbm9LrA2mn4EnLQnZXBCDaQgwvufwfdWc/19Zy59Twez8+AXiUsCy5F/nsAAAAABJRU5ErkJggg=="

# The templateImage parameter can also be used in the dropdown to allow Mac OS X to style the image
echo "Another option | templateImage=iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAA6hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxNi0wMi0yOVQxOTowMjowNjwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAzLjQuMTwveG1wOkNyZWF0b3JUb29sPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk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